package cn.biplam.back.operator.systemManage.sysprivi.user;

import cn.biplam.back.operator.systemManage.sysprivi.user.table.UserOpt;
import cn.biplam.back.operator.systemManage.sysprivi.user.table.UserPriviOpt;
import cn.biplam.back.operator.systemManage.sysprivi.user.table.UserRoleOpt;
import cn.biplam.common.client.OperatorResult;
import cn.biplam.common.interfaces.DataOperator;
import cn.biplam.common.opcode.SysManageCode.UserOptCode;
import cn.biplam.common.opcode.SysManageCode.UserPriviOptCode;
import cn.biplam.common.opcode.SysManageCode.UserRoleOptCode;
import cn.biplam.common.wrapper.ErrorMessage;

/**
 *  用户管理数据操作入口
 * @author XiaoRuxing Nov 2, 20095:26:12 PM
 * @version 1.0
 */
public class UserMgOpt extends DataOperator{

	private static final String Op_ID = "2811";
	
	public UserMgOpt() throws ErrorMessage {
		super();
	}

	/** 用户信息表操作 */
	public static final String User= UserOptCode.Op_ID;
	/** 用户索引表操作 */
	static final String User_Index = Op_ID+"3";
	/** 用户角色表操作 */
	static final String User_Role = UserRoleOptCode.Op_ID;
	/** 用户权限表操作 */
	static final String User_Privi = UserPriviOptCode.Op_ID;

	@Override
	protected OperatorResult _exchange() throws ErrorMessage {
		String exchangeId = opId.substring(0, 5);
		if(User.equals(exchangeId)){
			return new UserOpt().get(opId, userId, filter, dbResource);
		}else if(User_Index.equals(exchangeId)){
			return null;
		}else if(User_Role.equals(exchangeId)){
			return new UserRoleOpt().get(opId, userId, filter, dbResource);
		}else if(User_Privi.equals(exchangeId)){
			return new UserPriviOpt().get(opId, userId, filter, dbResource);
		}else{
			throw new ErrorMessage("Operator Exchange outport not found:"+ opId+" !");
		}
	}
}
